def sanjiao(n):
    if isinstance(n,int):
        if n > 0:
            for i in range(1,n+1):
                for j in range(n,0,-1):
                    sitej = len(str(j))
                    if j > i:
                        print("%*s" % (sitej," "),end=" ")
                    elif j == 1:
                        print(j,end="\n")
                    else:
                        print(j,end=" ")
                i-=1
        else:
            print("vaule must -gt 0.")
    else:
        print("not a usefull vaule.")

sanjiao(12)


# 做的不错, 不过代码有点多了